package com.mingtu.dzpatrol.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.blankj.utilcode.util.StringUtils;
import com.mingtu.dzpatrol.R;

/**
 * @ClassName :
 * @Author : wkk
 * @Date : 2020/5/11 17:30:15
 * @Email : 1281573890@qq.com
 * @Eescription :
 */
public class LoadingDialog extends Dialog {
    private ProgressBar pbLoading;
    private String title = "";
    private TextView tvText;

    public LoadingDialog(Context context) {
        super(context, R.style.LoadingDialogStyle);
    }

    public LoadingDialog(Context context, String title) {
        super(context, R.style.LoadingDialogStyle);
        this.title = title;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.loading_comment_layout);
        initView();

    }

    private void initView() {
        pbLoading = (ProgressBar) findViewById(R.id.pb_loading);
        tvText = (TextView) findViewById(R.id.tv_text);

        if (tvText != null) {
            if (!StringUtils.isEmpty(title)) {
                tvText.setText(title + "");
                tvText.setVisibility(View.VISIBLE);
            } else {
                tvText.setVisibility(View.GONE);
            }
        }
    }
}
